<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Registro de Departamentos</title>
    </h:head>
    <h:body>
        <h:form>
            <h:panelGrid columns="3">
                
                <h:outputLabel for="codigo" value="Código:" />
                <h:inputText id="codigo" value="#{departamentoBean.bean.codigo}" />
                <h:message for="codigo" />
                
                <h:outputLabel for="nome" value="Nome:" />
                <h:inputText id="nome" value="#{departamentoBean.bean.nome}" />
                <h:message for="nome" />
                
                
            </h:panelGrid>
            <h:commandButton value="Salvar">
                <f:actionListener class="edu.senai.contato.view.listner.SalvarDepartamentoListner" />
            </h:commandButton>
        </h:form>
        <h:form>
            <h:dataTable var="item" value="#{departamentoBean.registros}" >
                <h:column>
                    <f:facet name="header">Código</f:facet>
                    <h:outputText value="#{item.codigo}" />
                </h:column>
                <h:column>
                    <f:facet name="header">Nome</f:facet>
                    <h:outputText value="#{item.nome}" />
                </h:column>
            </h:dataTable>
        </h:form>
    </h:body>
</html>

